package interfaces;
 
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
 
public class IUsuario extends JFrame {
        private JButton alterarperfil;
        private JButton alterarsenha;
        private JButton voltar;
        private JButton mostrar;
        private JPanel painel1;
        private JPanel painelglobal;
        private JLabel labelnome;
        private JLabel labelsenha;
        private JLabel labelemail;
        private JLabel labeldescricao;
        private JLabel labelperfil;
        private JDesktopPane desktop;
 
        
        public IUsuario(String nome,String senha,String email,String descricao){
                
                JFrame janelausuario = new JFrame("Usuario " + nome);
                janelausuario.setSize(515,400);
                janelausuario.setUndecorated(false);
        FlowLayout layoutc = new FlowLayout(FlowLayout.CENTER);
        FlowLayout layoutl = new FlowLayout(FlowLayout.LEFT);
     
        //label
        labelperfil = new JLabel("Perfil");
        labelperfil.setBounds(200,-20,250,250);
        labelnome = new JLabel("Nome: " + nome);
        labelnome.setBounds(5,95,250,100);
        labelemail = new JLabel("Email: " + email);
        labelemail.setBounds(5,115,250,100);
        labelsenha = new JLabel("Senha: " + senha);
        labelsenha.setBounds(5,110,250,200);
        labeldescricao = new JLabel("Descricao: " + descricao);
        labeldescricao.setBounds(5,130,400,250);

        //Desktop
        desktop = new JDesktopPane();
        desktop.setBackground(Color.WHITE);
                //Butoes
        
                alterarperfil = new JButton("Alterar Perfil");
                alterarperfil.setIcon(new
                                ImageIcon("src/images/edituser.png"));
                alterarperfil.setBounds(5,5,120,72);
                alterarperfil.setBackground(Color.WHITE);
        		alterarperfil.setHorizontalTextPosition(SwingConstants.CENTER);
        		alterarperfil.setVerticalAlignment(SwingConstants.TOP);
        		alterarperfil.setVerticalTextPosition(SwingConstants.BOTTOM);
        		alterarperfil.addActionListener(new ActionListener() {
        			public void actionPerformed(ActionEvent e) {
        				alterarperfilActionPerformed(e);
        			}
        		});
                
                alterarsenha = new JButton("Alterar Senha");
                alterarsenha.setIcon(new
                                ImageIcon("src/images/alterakey.png"));
                alterarsenha.setBounds(127,5,120,72);
                alterarsenha.setBackground(Color.WHITE);
        		alterarsenha.setHorizontalTextPosition(SwingConstants.CENTER);
        		alterarsenha.setVerticalAlignment(SwingConstants.TOP);
        		alterarsenha.setVerticalTextPosition(SwingConstants.BOTTOM);
        		alterarsenha.addActionListener(new ActionListener() {
        			public void actionPerformed(ActionEvent e) {
        				alterarsenhaActionPerformed(e);
        			}
        		});

                
                voltar = new JButton("Voltar");
                voltar.setIcon(new
                        ImageIcon("src/images/back2.png"));
                voltar.setBounds(415,5,90,72);
                voltar.setBackground(Color.WHITE);
        		voltar.setHorizontalTextPosition(SwingConstants.CENTER);
        		voltar.setVerticalAlignment(SwingConstants.TOP);
        		voltar.setVerticalTextPosition(SwingConstants.BOTTOM);
        		voltar.addActionListener(new ActionListener() {
        			public void actionPerformed(ActionEvent e) {
        				voltarActionPerformed(e);
        			}
        		});
        		
        		mostrar = new JButton("Mostrar Senha");
                mostrar.setBounds(5,180,120,25);
        		mostrar.setHorizontalTextPosition(SwingConstants.CENTER);
        		mostrar.setVerticalAlignment(SwingConstants.TOP);
        		mostrar.setVerticalTextPosition(SwingConstants.BOTTOM);
        		final int controle = 0;
        		mostrar.addActionListener(new ActionListener() {
        			public void actionPerformed(ActionEvent e) {
        				mostrarActionPerformed(e,controle);
        			}
        		});
        		
                //paineis
                painel1 = new JPanel(layoutl);
                painel1.setBounds(5,210,300,30);
                painel1.setBackground(Color.WHITE);

                painelglobal = new JPanel(layoutc);
                                
                //adds
                
                desktop.add(alterarperfil);
                desktop.add(alterarsenha);
                desktop.add(voltar);
                desktop.add(labelperfil);
                desktop.add(labelnome);
                desktop.add(labelemail);
                desktop.add(labeldescricao);
                painel1.add(labelsenha);
                desktop.add(mostrar);
                desktop.add(painel1);
                
                painel1.setVisible(false);
                
                janelausuario.setContentPane(desktop);
              
        janelausuario.setResizable(false);
        janelausuario.setVisible(true);
        janelausuario.setDefaultCloseOperation( WindowConstants.
                       EXIT_ON_CLOSE);
                
        }
    	public void alterarsenhaActionPerformed(ActionEvent e) {

    	}
    	public void alterarperfilActionPerformed(ActionEvent e) {

    	}
    	public void voltarActionPerformed(ActionEvent e) {

    	}
    	public void mostrarActionPerformed(ActionEvent e,int controle) {
    		if(controle == 0){
    			painel1.setVisible(true);
    			controle = 1;
    		}
    		else{
    			painel1.setVisible(false);
    			controle = 0;
    		}

    	}
        public static void main(String[] args){
                IUsuario bla = new IUsuario("BOBINHOOO","eitadrascrativasicachorradanadenha","kelvin@gmail.com","antrofuckmitologico"); 
        }
}
 